package com.excuse.excusebuilder.view.activity;

import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar;
import android.widget.Button;
import android.widget.EditText;

import com.excuse.excusebuilder.R;
import com.excuse.excusebuilder.base.BaseActivity;
import com.excuse.excusebuilder.bean.Option;
import com.excuse.excusebuilder.presenter.AddExcuseActivityPresenter;
import com.excuse.excusebuilder.presenter.AddResultActivityPresenter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class AddResultActivity extends BaseActivity implements AddResultActivityPresenter.IView {
    public static final String PARAM_OPTION = "param_option";
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.app_bar)
    AppBarLayout appBar;
    @BindView(R.id.result_edt)
    EditText resultEdt;
    @BindView(R.id.add_btn)
    Button addBtn;
    private Option option;
    private AddResultActivityPresenter presenter;


    @Override
    protected void initData() {
        option = (Option) getIntent().getSerializableExtra(PARAM_OPTION);
        initToolbar(toolbar, "添加更多借口");
        presenter = new AddResultActivityPresenter(this, this);
    }

    @Override
    public int getLayoutResId() {
        return R.layout.activity_add_result;
    }

    @Override
    public void showRefreshing(boolean isShow) {

    }


    @OnClick(R.id.add_btn)
    public void onViewClicked() {
        String resultStr = resultEdt.getText().toString().trim();
        presenter.addResult(option, resultStr);
    }
}
